package com.club.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.club.entity.TClub;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author zhangfc
 * @date 2022/12/12 16:53
 */
public interface TClubMapper extends BaseMapper<TClub> {

    @Select("select count(1) as size from t_club")
    public int sizeByTClub();

    @Select("select right(club_number,4) as num from t_club order by club_number")
    public String lastNum();

    @Select("select uc.ismanager,t.*,su.name as create_name from user_club_relation uc " +
            "left join t_club t on uc.club_id = t.club_id " +
            "left join sys_user su on t.user_id = su.id " +
            "where uc.user_id = #{userId}")
    public List<Map<String,Object>> listClubByUserId(@Param("userId") int userId);

}
